﻿@model Model.tb_DeviceIN
@{
    ViewBag.Title = "doDeviceINInfo";
}
<!DOCTYPE html>

<head>
    <meta name="viewport" content="width=device-width" />
    <title>仪器设备-入库</title>
    <link rel="stylesheet" type="text/css" href='@Url.Content("~/Scripts/jquery-easyui/themes/default/easyui.css")'>
    <link rel="stylesheet" type="text/css" href='@Url.Content("~/Scripts/jquery-easyui/themes/icon.css")'>
    <link rel="stylesheet" type="text/css" href='@Url.Content("~/Scripts/jquery-easyui/demo.css")'>
    <link rel="stylesheet" type="text/css" href='@Url.Content("~/Scripts/uploader/uploadify.css")' />
    <link rel="stylesheet" type="text/css" href='@Url.Content("~/Scripts/Validform/style.css")'  />
    <script type="text/javascript" src='@Url.Content("~/Scripts/jquery-1.8.2.min.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/jquery-easyui/jquery.easyui.min.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/jquery-easyui/locale/easyui-lang-zh_CN.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/uploader/jquery.uploadify.min.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/uploader/swfobject.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/MicrosoftAjax.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/MicrosoftMvcAjax.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/Validform/Validform_v5.3.2_min.js")'></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/My97DatePicker/WdatePicker.js")'></script>
    <script type="text/javascript">
        $(document).ready(function () {
            @{
                string devicename = "";
                if (Model != null && Model.id > 0 && Model.deviceId > 0)
                {
                    devicename = new BLL.tb_DeviceBLL().GetModel(Model.deviceId.Value).name;
                      
                }
            }
            $('#ddl_device').combogrid({
                delay: 500,
                panelWidth: 350,
                value: '@devicename',
                mode: 'remote',
                idField: 'id',
                textField: 'name',
                url: '/Device/GetDeviceListForDropDownList',
                onSelect: function (rowIndex, rowData) {
                    $('#zichangbianhao').html(rowData.pCode);
                    $('#shebeibianhao').html(rowData.eCode);
                    $('#deviceId').val(rowData.id);
                    $('#danwei').html(rowData.temp2);
                    $('#kucun').html(rowData.amount);
                },
                columns: [[
                    { field: 'name', title: '名称', width: 250 },
                    { field: 'pCode', title: '资产编号', width: 100 },
                    { field: 'eCode', title: '设备编号', width: 100 }
                ]]
            });
            /*页面控件验证*/
            $("#deviceId").attr("datatype", "d");
            $("#InDate").attr("datatype", "*");
            $("#amount").attr("datatype", "*");
            $("#uploadfrm").Validform({
                tiptype: 3
            });
            /*结束 页面控件验证*/
            $('#InDate').click(function () { WdatePicker() });

        });
        function handle(e) {
            if (e == "1") {
                window.parent.$('#dgtable').datagrid("reload");
                alert("保存成功！");
                $('#dlg').dialog('close');
            } else {
                alert("保存失败！");
            }
        }
        function failed(e) {
            alert("保存失败！");
        }
    </script>
    <style type="text/css">
        .divList {
            position: absolute;
            top: 40px;
            left: 1px;
            z-index: 99;
            width: 1048px;
        }

        a {
            text-decoration: none;
            color: #000;
        }

            a img {
                border: 0;
            }

        .biaoge {
            width: 1040px;
            font-family: '宋体';
            font-size: 12px;
            color: #10607c;
        }

            .biaoge td {
                text-align: center;
                height: 26px;
                vertical-align: middle;
                border: 1px solid #d4d3d3;
            }

        .data_tab02 {
            height: 22px;
            margin: 0px;
            padding-left: 2px;
            background: url(Content/Images/tab_bg02.gif) repeat-x;
        }

            .data_tab02 dd {
                width: 100px;
                height: 22px;
                line-height: 22px;
                float: left;
                text-align: center;
                cursor: pointer;
                margin-right: 2px;
            }

                .data_tab02 dd a {
                    display: block;
                    clear: both;
                    background: url(../../Content/Images/dlbeijing.png);
                    width: 100px;
                    height: 25px;
                    color: #FFFFFF;
                    font-size: 13px;
                }

                    .data_tab02 dd a:hover {
                        color: #ff9c00;
                    }

                    .data_tab02 dd a:focus {
                        color: #ff9c00;
                    }
    </style>
</head>
<body>
    @using (Ajax.BeginForm("DeviceINCU", "Device", new AjaxOptions { HttpMethod = "Post", OnSuccess = "handle", OnFailure = "failed" }, new { @id = "uploadfrm" }))
    {
        
        @Html.HiddenFor(m => m.id)
        @Html.HiddenFor(m => m.createDate, new { @id = "createDateE" })
        @Html.HiddenFor(m => m.createUser, new { @id = "createUserE" })
        @Html.HiddenFor(m => m.temp1, new { @id = "temp1E" })
        @Html.HiddenFor(m => m.temp2, new { @id = "temp2E" })
        @Html.HiddenFor(m => m.updateDate, new { @id = "updateDateE" })
        @Html.HiddenFor(m => m.updateUser, new { @id = "updateUserE" })
        <table align="left" height="300px" style="font-family: '宋体'; font-size: 12px;">
            <tr>
                <td width="90px" align="right">设备（仪器）名称：</td>
                <td align="left" colspan="3">
                    <select id="ddl_device" style="width: 300px"></select>
                    @Html.HiddenFor(m => m.deviceId)
                </td>
            </tr>
            @{
            if (Model != null && Model.id > 0 && Model.deviceId > 0)
            {
                Model.tb_Device devicemodel = new BLL.tb_DeviceBLL().GetModel(Model.deviceId.Value);
                if (devicemodel != null && devicemodel.id > 0)
                {
                                <tr>
                                    <td width="90px" align="right">资产编号：</td>
                                    <td align="left" id="zichangbianhao">@devicemodel.pCode</td>
                                    <td width="90px" align="right">设备编号：</td>
                                    <td align="left" id="shebeibianhao">@devicemodel.eCode</td>
                                </tr>
                                <tr>
                                    <td width="90px" align="right">库存：</td>
                                    <td align="left" id="kucun">@devicemodel.amount</td>
                                    <td width="90px" align="right">单位：</td>
                                    <td align="left" id="danwei">@devicemodel.companyId</td>
                                </tr>
                }           
            }else
                {
                            <tr>
                                    <td width="90px" align="right">资产编号：</td>
                                    <td align="left" id="zichangbianhao"></td>
                                    <td width="90px" align="right">设备编号：</td>
                                    <td align="left" id="shebeibianhao"></td>
                                </tr>
                                <tr>
                                    <td width="90px" align="right">库存：</td>
                                    <td align="left" id="kucun"></td>
                                    <td width="90px" align="right">单位：</td>
                                    <td align="left" id="danwei"></td>
                                </tr>
                }
            }
            
            <tr>
                <td width="90px" align="right">入库日期：</td>
                <td align="left">
                    @Html.TextBoxFor(m => m.InDate)
                </td>
                <td width="90px" align="right">入库数量：</td>
                <td align="left">
                    @Html.TextBoxFor(m => m.amount)
                </td>
            </tr>
            <tr>
                <td colspan="4" align="center">
                    <a href="javascript:void(0)" onclick="$('#uploadfrm').submit()">
                        <img src="~/Content/Images/baocun.png" height="20px" /></a>
                    <a href="javascript:void(0)" onclick="window.parent.$('#dlg').dialog('close')">
                        <img src="~/Content/Images/fanhui.png" height="20px" />
                    </a></td>
            </tr>
        </table>
    }
</body>
